package view.component.effects
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	import framework.core.UIWidget;
	
	import mapengine.effects.EffectObjectBase;
	import mapengine.effects.IEffectAsset;
	
	public class BattleTextFieldView extends Sprite implements IEffectAsset
	{
		public function BattleTextFieldView()
		{
			super();
			init();
		}
		
		protected function get classRef():String
		{
			return "swf.ui.BattleTopTF";
		}
		
		protected var skin:MovieClip;
		
		protected function init():void
		{
			skin = UIWidget.createUI(classRef) as MovieClip;
			this.addChild(skin);
		}
		
		public function set text(value:String):void
		{
			skin.label.text = value;
		}
		
		private var _effectObj:EffectObjectBase;
		
		public function get effectObj():EffectObjectBase
		{
			return _effectObj;
		}
		
		public function set effectObj(value:EffectObjectBase):void
		{
			_effectObj = value;
		}
		
		public function dispose():void
		{
			if(skin)
			{
				skin.parent && skin.parent.removeChild(skin);
			}
			
			if(parent)
			{
				parent.removeChild(this);
			}
			
			if(_effectObj)
			{
				_effectObj.dispose();
			}
		}
	}
}